package com.shujia.json;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStream;
import java.util.Properties;

public class Demo3ProperTies {
    public static void main(String[] args) throws Exception {

        //读取Properties配置文件
        Properties properties = new Properties();
        //properties.load(new FileReader("java/data/config.properties"));

        //将文件存放在resources里面
        InputStream resourceAsStream = Demo3ProperTies.class.getClassLoader().getResourceAsStream("config.properties");
        properties.load(resourceAsStream);

        //通过key获取value
        String path = properties.getProperty("path");

        System.out.println(path);

    }
}
